function [ imageFeatures ] =...
    computeMacularData( fovRow, fovCol, opDiskRow, opDiskCol, blueIm, degreesFromFov )
%UNTITLED2 Summary of this function goes here
%   Outputs are macBoundary, macRegion, notMacRegion


opDiskRadius = norm([fovRow - opDiskRow, fovCol - opDiskCol]);
opDiskRadius = floor(opDiskRadius);
% We are interested in the region 4 degrees from the fovea, so set up the
% radius 4 degrees from the fovea. 4/12 is the conversion from pixel to
% degree.
macRadius = round((degreesFromFov/12)*opDiskRadius);

%Determine number of points that make up macRadius
nMacBoundaryPts = round(2*pi*macRadius);

THETA = linspace(0, 2*pi, nMacBoundaryPts);
RHO   = ones(1,nMacBoundaryPts)*macRadius;

[X, Y] = pol2cart(THETA,RHO);
X = X + fovCol;
Y = Y + fovRow;
X = round(X);
Y = round(Y);

iMacBoundary = sub2ind(size(blueIm), Y, X);

%Generate a list of pixels inside the macular region
[nRowsIm nColsIm] = size(blueIm);
tempMacRegion = zeros(nRowsIm, nColsIm);
for rowPosition = 1 : nRowsIm
    for colPosition = 1 : nColsIm
        % We want to highlight in white all the pixels in the macular
        % boundary. Calculate the distances between any point and the
        % center, and if it is less than the radius, it is within the
        % boundary.
        if (norm([rowPosition - fovRow, colPosition - fovCol])...
                <= macRadius )
            % Highlight pixels inside boundary in white.
            tempMacRegion(rowPosition,colPosition) = 1; 
        end
    end
end
% Store all pixel locations of the macular region
iMacRegion = logical(tempMacRegion(:));

% Generate a list of pixels outside the macular region
tempNonMacRegion = zeros(nRowsIm, nColsIm);
    for rowPosition = 1 : nRowsIm
        for colPosition = 1 : nColsIm
            if ( norm([rowPosition - fovRow, colPosition - fovCol])...
                    > macRadius+1 )
                tempNonMacRegion(rowPosition,colPosition) = 1;
            end
        end
    end
iNonMacRegion = logical(tempNonMacRegion(:));

imageFeatures.fovRow = fovRow;
imageFeatures.fovCol = fovCol;
imageFeatures.macRadius = macRadius;
imageFeatures.iMacBoundary = iMacBoundary;
imageFeatures.iMacRegion = iMacRegion; 
imageFeatures.iNonMacRegion = iNonMacRegion;

end

